package com.huayue.service;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.huayue.dao.BaseDao;
import com.huayue.dao.DepartmentDao;
import com.huayue.dao.EmployeeDao;
import com.huayue.dao.RoleDao;
import com.huayue.entity.Employee;

/**
 * 员工
 * 
 */
@Service
public class EmployeeService extends BaseService<Employee> {

    @Autowired
    EmployeeDao employeeDao;

    @Autowired
    DepartmentDao departmentDao;

    @Autowired
    RoleDao roleDao;

    @Override
    public BaseDao<Employee> getDao() {
        return employeeDao;
    }

    public List<Map<String, Object>> findAllDep() {
        return departmentDao.findAll();
    }

    public List<Map<String, Object>> findAllRole() {
        return roleDao.findAll();
    }

    /**
     * 查询一个用户账户（手机号）是否存在
     */
    public Map<String, Object> findOneByPhone(Employee employee) {
        return employeeDao.findOneByPhone(employee);
    }

    /**
     * 修改用户头像 传入id和头像的地址
     * 
     * @param employee
     * @return
     */
    public int updateIcon(Employee employee) {
        return employeeDao.updateIcon(employee);
    }

    /**
     * 查询所有拥有审核请购单权限的员工
     * 
     * @return
     */
    public List<Map<String, Object>> findCanAuditRequisitionOrder() {
        return employeeDao.findCanAuditRequisitionOrder();
    }
}
